<%@page import="com.mavenrentcars.model.Reservation"%>
<%@page import="java.util.List"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/header.jsp" %>

<% 
	List<Reservation> list = (List<Reservation>) request.getAttribute("list");
%>

        <h1>Orders List</h1> 
        <% if(list != null) { %>
		<div id="cars_list">
            
            <table>
                <thead>
                    <tr>
                        <th>Status</th>
                        <th>Begin Date</th>
                        <th>End Date</th>
                        <th>Finish Place</th>
                        <th>Car</th>
                        <th>User</th>
                    </tr>
                </thead>
                <tbody>
                    <%
                    for(Reservation item : list) {
                    %>
                    <tr>
                        <td><%=item.getStatus() %></td>
                        <td><%=item.getBeginDate() %></td>
                        <td><%=item.getEndDate() %></td>
                        <td><%=item.getFinishPlace().getPlaceName() %></td>
                        <td>
                            <a href="car_item.htm?id=<%=item.getCar().getId() %>" > 
                                <%= item.getCar().getModel() %>
                            </a>
                        </td>
                        <td>
                            <a href="account_item.htm?id=<%=item.getUser().getId() %>" > 
                                <%= item.getUser().getUserName() %>
                            </a>
                        </td>
                    </tr>
                    <% } %>
                                
                </tbody>
            </table>

        </div>
        <% } %>
		
    
<%@ include file="/WEB-INF/jsp/footer.jsp" %>